<?php

import('TagLib');
class TagLibHtml extends TagLib
{
public function _initialize() {
$this->xml = dirname(__FILE__).'/Tags/html.xml';
}
public function _editor($attr)
{
$tag        =	$this->parseXmlAttr($attr,'editor');
$id			=	!empty($tag['id'])?$tag['id']: '_editor';
$name   	=	$tag['name'];
$style   	    =	!empty($tag['style'])?$tag['style']:'width:750px; height:350px;';
$width		=	!empty($tag['width'])?$tag['width']: '100%';
$height     =	!empty($tag['height'])?$tag['height'] :'320px';
$content    =   $tag['content'];
$type       =   $tag['type'] ;
switch(strtoupper($type)) {
case 'FCKEDITOR':
$parseStr   =	'<!-- 编辑器调用开始 --><script type="text/javascript" src="__ROOT__/Public/Js/FCKeditor/fckeditor.js"></script><textarea id="'.$id.'" name="'.$name.'">'.$content.'</textarea><script type="text/javascript"> var oFCKeditor = new FCKeditor( "'.$id.'","'.$width.'","'.$height.'" ) ; oFCKeditor.BasePath = "__ROOT__/Public/Js/FCKeditor/" ; oFCKeditor.ReplaceTextarea() ;function resetEditor(){setContents("'.$id.'",document.getElementById("'.$id.'").value)}; function saveEditor(){document.getElementById("'.$id.'").value = getContents("'.$id.'");} function InsertHTML(html){ var oEditor = FCKeditorAPI.GetInstance("'.$id.'") ;if (oEditor.EditMode == FCK_EDITMODE_WYSIWYG ){oEditor.InsertHtml(html) ;}else	alert( "FCK必须处于WYSIWYG模式!" ) ;}</script> <!-- 编辑器调用结束 -->';
break;
case 'EWEBEDITOR':
$parseStr	=	"<!-- 编辑器调用开始 --><script type='text/javascript' src='__ROOT__/Public/Js/eWebEditor/js/edit.js'></script><input type='hidden'  id='{$id}' name='{$name}'  value='{$conent}'><iframe src='__ROOT__/Public/Js/eWebEditor/ewebeditor.htm?id={$name}' frameborder=0 scrolling=no width='{$width}' height='{$height}'></iframe><script type='text/javascript'>function saveEditor(){document.getElementById('{$id}').value = getHTML();} </script><!-- 编辑器调用结束 -->";
break;
case 'NETEASE':
$parseStr   =	'<!-- 编辑器调用开始 --><textarea id="'.$id.'" name="'.$name.'" style="display:none">'.$content.'</textarea><iframe ID="Editor" name="Editor" src="__ROOT__/Public/Js/HtmlEditor/index.html?ID='.$name.'" frameBorder="0" marginHeight="0" marginWidth="0" scrolling="No" style="height:'.$height.';width:'.$width.'"></iframe><!-- 编辑器调用结束 -->';
break;
case 'UBB':
$parseStr	=	'<script type="text/javascript" src="__ROOT__/Public/Js/UbbEditor.js"></script><div style="padding:1px;width:'.$width.';border:1px solid silver;float:left;"><script LANGUAGE="JavaScript"> showTool(); </script></div><div><TEXTAREA id="UBBEditor" name="'.$name.'"  style="clear:both;float:none;width:'.$width.';height:'.$height.'" >'.$content.'</TEXTAREA></div><div style="padding:1px;width:'.$width.';border:1px solid silver;float:left;"><script LANGUAGE="JavaScript">showEmot();  </script></div>';
break;
case 'KINDEDITOR':
$parseStr="<script type='text/javascript'> var eid = '".$id."';".
'KE.show({'.
'id : eid,'.
"skinType: 'tinymce',".
'allowFileManager : true,'.
'resizeMode : 0,'.
"items : [
							'source','fullscreen', 'undo', 'redo', 'print', 'cut', 'copy', 'paste',
							'plainpaste', 'wordpaste', 'justifyleft', 'justifycenter', 'justifyright',
							'justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', 'subscript',
							'superscript', 'selectall', '-',
							'title', 'fontname', 'fontsize', 'textcolor', 'bgcolor', 'bold',
							'italic', 'underline', 'strikethrough', 'removeformat', 'image',
							'flash', 'media', 'table', 'hr', 'emoticons', 'link', 'unlink'
						]	".
'});'.
'</script>';
$parseStr.="<div  style='margin-bottom:5px; '><textarea id='".$id."' name='".$name."' style='".$style."' >".$content.'</textarea> </div>';
break;
case 'MAILEDITOR':
$parseStr="<script type='text/javascript'> var eid = '".$id."';".
'KE.show({'.
'id : eid,'.
"skinType: 'tinymce',".
'allowFileManager : true,'.
"urlType : 'domain',".
'resizeMode : 0'.
'});'.
'</script>';
$parseStr.="<div  style='margin-bottom:5px; '><textarea id='".$id."' name='".$name."' style='".$style."' >".$content.'</textarea> </div>';
break;
default :
$parseStr  =  '<textarea id="'.$id.'" style="'.$style.'" name="'.$name.'" >'.$content.'</textarea>';
}
return $parseStr;
}
public function _link($attr)
{
$tag        = $this->parseXmlAttr($attr,'link');
$file       = $tag['href'];
$type       = isset($tag['type'])?
strtolower($tag['type']):
strtolower(substr(strrchr($file,'.'),1));
if($type=='js') {
$parseStr = "<script type='text/javascript' src='".$file."'></script> ";
}elseif($type=='css') {
$parseStr = "<link rel='stylesheet' type='text/css' href='".$file."' />";
}
return $parseStr;
}
public function _import($attr)
{
$tag        = $this->parseXmlAttr($attr,'import');
$file       = $tag['file'];
$basepath   = !empty($tag['basepath'])?$tag['basepath']:WEB_PUBLIC_PATH;
$type       = !empty($tag['type'])?strtolower($tag['type']):'js';
if($type=='js') {
$parseStr = "<script type='text/javascript' src='".$basepath.'/'.str_replace(array('.','#'),array('/','.'),$file).'.js'."'></script> ";
}elseif($type=='css') {
$parseStr = "<link rel='stylesheet' type='text/css' href='".$basepath.'/'.str_replace(array('.','#'),array('/','.'),$file).'.css'."' />";
}
return $parseStr;
}
public function _imageBtn($attr)
{
$tag        = $this->parseXmlAttr($attr,'imageBtn');
$name       = $tag['name'];
$value      = $tag['value'];
$id         = $tag['id'];
$style      = $tag['style'];
$click      = $tag['click'];
$type       = empty($tag['type'])?'button':$tag['type'];
if(!empty($name)) {
$parseStr   = '<div class="'.$style.'" ><input type="'.$type.'" id="'.$id.'" name="'.$name.'" value="'.$value.'" onclick="'.$click.'" class="'.$name.' imgButton"></div>';
}else {
$parseStr   = '<div class="'.$style.'" ><input type="'.$type.'" id="'.$id.'"  name="'.$name.'" value="'.$value.'" onclick="'.$click.'" class="button"></div>';
}
return $parseStr;
}
public function _imgLink($attr)
{
$tag        = $this->parseXmlAttr($attr,'imgLink');
$name       = $tag['name'];
$alt        = $tag['alt'];
$id         = $tag['id'];
$style      = $tag['style'];
$click      = $tag['click'];
$type       = $tag['type'];
if(empty($type)) {
$type = 'button';
}
$parseStr   = '<span class="'.$style.'" ><input title="'.$alt.'" type="'.$type.'" id="'.$id.'"  name="'.$name.'" onmouseover="this.style.filter=\'alpha(opacity=100)\'" onmouseout="this.style.filter=\'alpha(opacity=80)\'" onclick="'.$click.'" align="absmiddle" class="'.$name.' imgLink"></span>';
return $parseStr;
}
public function _select($attr)
{
$tag        = $this->parseXmlAttr($attr,'select');
$name       = $tag['name'];
$options    = $tag['options'];
$values     = $tag['values'];
$output     = $tag['output'];
$multiple   = $tag['multiple'];
$id         = $tag['id'];
$size       = $tag['size'];
$first      = $tag['first'];
$selected   = $tag['selected'];
$style      = $tag['style'];
$ondblclick = $tag['dblclick'];
$onchange	= $tag['change'];
if(!empty($multiple)) {
$parseStr = '<select id="'.$id.'" name="'.$name.'" ondblclick="'.$ondblclick.'" onchange="'.$onchange.'" multiple="multiple" class="'.$style.'" size="'.$size.'" >';
}else {
$parseStr = '<select id="'.$id.'" name="'.$name.'" onchange="'.$onchange.'" ondblclick="'.$ondblclick.'" class="'.$style.'" >';
}
if(!empty($first)) {
$parseStr .= '<option value="" >'.$first.'</option>';
}
if(!empty($options)) {
$parseStr   .= '<?php  foreach($'.$options.' as $key=>$val) { ?>';
if(!empty($selected)) {
$parseStr   .= '<?php if(!empty($'.$selected.') && ($'.$selected.' == $key || in_array($key,$'.$selected.'))) { ?>';
$parseStr   .= '<option selected="selected" value="<?php echo $key ?>"><?php echo $val ?></option>';
$parseStr   .= '<?php }else { ?><option value="<?php echo $key ?>"><?php echo $val ?></option>';
$parseStr   .= '<?php } ?>';
}else {
$parseStr   .= '<option value="<?php echo $key ?>"><?php echo $val ?></option>';
}
$parseStr   .= '<?php } ?>';
}else if(!empty($values)) {
$parseStr   .= '<?php  for($i=0;$i<count($'.$values.');$i++) { ?>';
if(!empty($selected)) {
$parseStr   .= '<?php if(isset($'.$selected.') && ((is_string($'.$selected.') && $'.$selected.' == $'.$values.'[$i]) || (is_array($'.$selected.') && in_array($'.$values.'[$i],$'.$selected.')))) { ?>';
$parseStr   .= '<option selected="selected" value="<?php echo $'.$values.'[$i] ?>"><?php echo $'.$output.'[$i] ?></option>';
$parseStr   .= '<?php }else { ?><option value="<?php echo $'.$values.'[$i] ?>"><?php echo $'.$output.'[$i] ?></option>';
$parseStr   .= '<?php } ?>';
}else {
$parseStr   .= '<option value="<?php echo $'.$values.'[$i] ?>"><?php echo $'.$output.'[$i] ?></option>';
}
$parseStr   .= '<?php } ?>';
}
$parseStr   .= '</select>';
return $parseStr;
}
public function _checkbox($attr)
{
$tag        = $this->parseXmlAttr($attr,'checkbox');
$name       = $tag['name'];
$checkboxes = $tag['checkboxes'];
$checked    = $tag['checked'];
$separator  = $tag['separator'];
$checkboxes = $this->tpl->get($checkboxes);
$checked    = $this->tpl->get($checked)?$this->tpl->get($checked):$checked;
$parseStr   = '';
foreach($checkboxes as $key=>$val) {
if($checked == $key  ||in_array($key,$checked) ) {
$parseStr .= '<input type="checkbox" checked="checked" name="'.$name.'[]" value="'.$key.'">'.$val.$separator;
}else {
$parseStr .= '<input type="checkbox" name="'.$name.'[]" value="'.$key.'">'.$val.$separator;
}
}
return $parseStr;
}
public function _radio($attr)
{
$tag        = $this->parseXmlAttr($attr,'radio');
$name       = $tag['name'];
$radios     = $tag['radios'];
$checked    = $tag['checked'];
$separator  = $tag['separator'];
$radios     = $this->tpl->get($radios);
$checked    = $this->tpl->get($checked)?$this->tpl->get($checked):$checked;
$parseStr   = '';
foreach($radios as $key=>$val) {
if($checked == $key ) {
$parseStr .= '<input type="radio" checked="checked" name="'.$name.'[]" value="'.$key.'">'.$val.$separator;
}else {
$parseStr .= '<input type="radio" name="'.$name.'[]" value="'.$key.'">'.$val.$separator;
}
}
return $parseStr;
}
public function _list($attr)
{
$tag        = $this->parseXmlAttr($attr,'list');
$id         = $tag['id'];
$datasource = $tag['datasource'];
$pk         = empty($tag['pk'])?'id':$tag['pk'];
$style      = $tag['style'];
$name       = !empty($tag['name'])?$tag['name']:'vo';
$action     = $tag['action'];
$checkbox   = $tag['checkbox'];
$actionwidth   = $tag['actionwidth'];
if(isset($tag['actionlist'])) {
$actionlist = explode(',',trim($tag['actionlist']));
}
if(substr($tag['show'],0,1)=='$') {
$show   = $this->tpl->get(substr($tag['show'],1));
}else {
$show   = $tag['show'];
}
$show       = explode(',',$show);
$colNum     = count($show);
if(!empty($checkbox))   $colNum++;
if(!empty($action))     $colNum++;
$parseStr	= "<!-- Think 系统列表组件开始 -->\n";
$parseStr  .= '<table id="'.$id.'" class="'.$style.'" cellpadding=0 cellspacing=0 >';
$parseStr  .= '<tr><td colspan="'.$colNum.'" class="topTd" >&nbsp; </td></tr>';
$parseStr  .= '<tr class="row" >';
$fields = array();
foreach($show as $key=>$val) {
$fields[] = explode(':',$val);
}
if(!empty($checkbox) &&'true'==strtolower($checkbox)) {
$parseStr .='<th width="8"><input type="checkbox" id="check" onclick="CheckAll(\''.$id.'\')"></th>';
}
foreach($fields as $field) {
$property = explode('|',$field[0]);
$showname = explode('|',$field[1]);
if(isset($showname[1])) {
$parseStr .= '<th width="'.$showname[1].'">';
}else {
$parseStr .= '<th>';
}
$showname[2] = isset($showname[2])?$showname[2]:$showname[0];
$parseStr .= '<a href="javascript:sortBy(\''.$property[0].'\',\'{$sort}\',\''.MODULE_NAME.'\',\''.ACTION_NAME.'\')" title="'.L('TAG_LANG_ORDER').$showname[2].'{$sortType} ">'.$showname[0].'<eq name="order" value="'.$property[0].'" ><img src="__TMPL__Common/images/{$sortImg}.gif" width="12" height="17" border="0" align="absmiddle"></eq></a></th>';
}
if(!empty($action)) {
$parseStr .= '<th style="width:'.$actionwidth.'">'.l('TAG_LANG_OPERATE').'</th>';
}
$parseStr .= '</tr>';
$parseStr .= '<volist name="'.$datasource.'" id="'.$name.'" ><tr class="row" >';
if(!empty($checkbox)) {
$parseStr .= '<td><input type="checkbox" name="key" class="key" value="{$'.$name.'.'.$pk.'}"></td>';
}
foreach($fields as $field) {
$parseStr   .=  '<td>&nbsp;';
if(!empty($field[2])) {
$href = explode('|',$field[2]);
if(count($href)>1) {
$array = explode('^',$href[1]);
if(count($array)>1) {
foreach ($array as $a){
$temp[] =  '\'{$'.$name.'.'.$a.'|addslashes}\'';
}
$parseStr .= '<a href="javascript:'.$href[0].'('.implode(',',$temp).')">';
}else{
$parseStr .= '<a href="javascript:'.$href[0].'(\'{$'.$name.'.'.$href[1].'|addslashes}\')">';
}
}else {
$parseStr .= '<a href="javascript:'.$field[2].'(\'{$'.$name.'.'.$pk.'|addslashes}\')">';
}
}
if(strpos($field[0],'^')) {
$property = explode('^',$field[0]);
foreach ($property as $p){
$unit = explode('|',$p);
if(count($unit)>1) {
$parseStr .= '{$'.$name.'.'.$unit[0].'|'.$unit[1].'} ';
}else {
$parseStr .= '{$'.$name.'.'.$p.'} ';
}
}
}else{
$property = explode('|',$field[0]);
if(count($property)>1) {
$property[1] = str_replace('#',',',$property[1]);
$parseStr .= '{$'.$name.'.'.$property[0].'|'.$property[1].'}';
}else {
$parseStr .= '{$'.$name.'.'.$field[0].'}';
}
}
if(!empty($field[2])) {
$parseStr .= '</a>';
}
$parseStr .= '</td>';
}
if(!empty($action)) {
if(!empty($actionlist[0])) {
$parseStr .= '<td>';
foreach($actionlist as $val) {
if(strpos($val,':')) {
$a = explode(':',$val);
$b = explode('|',$a[1]);
if(count($b)>1) {
$c = explode('|',$a[0]);
if(count($c)>1) {
$parseStr .= '<a href="javascript:'.$c[1].'(\'{$'.$name.'.'.$pk.'}\')"><?php if(0== (is_array($'.$name.')?$'.$name.'["status"]:$'.$name.'->status)){ ?>'.$b[1].'<?php } ?></a><a href="javascript:'.$c[0].'({$'.$name.'.'.$pk.'})"><?php if(1== (is_array($'.$name.')?$'.$name.'["status"]:$'.$name.'->status)){ ?>'.$b[0].'<?php } ?></a>&nbsp;';
}else {
$parseStr .= '<a href="javascript:'.$a[0].'(\'{$'.$name.'.'.$pk.'}\')"><?php if(0== (is_array($'.$name.')?$'.$name.'["status"]:$'.$name.'->status)){ ?>'.$b[1].'<?php } ?><?php if(1== (is_array($'.$name.')?$'.$name.'["status"]:$'.$name.'->status)){ ?>'.$b[0].'<?php } ?></a>&nbsp;';
}
}else {
$parseStr .= '<a href="javascript:'.$a[0].'(\'{$'.$name.'.'.$pk.'}\')">'.$a[1].'</a>&nbsp;';
}
}else{
$array	=	explode('|',$val);
if(count($array)>2) {
$parseStr	.= ' <a href="javascript:'.$array[1].'(\'{$'.$name.'.'.$array[0].'}\')">'.$array[2].'</a>&nbsp;';
}else{
$parseStr .= ' {$'.$name.'.'.$val.'}&nbsp;';
}
}
}
$parseStr .= '</td>';
}
}
$parseStr	.= '</tr></volist><tr><td colspan="'.$colNum.'" class="bottomTd"> &nbsp;</td></tr></table>';
$parseStr	.= "\n<!-- Think 系统列表组件结束 -->\n";
return $parseStr;
}
public function _tree_list($attr)
{
$tag        = $this->parseXmlAttr($attr,'list');
$id         = $tag['id'];
$datasource = $tag['datasource'];
$pk         = empty($tag['pk'])?'id':$tag['pk'];
$style      = $tag['style'];
$name       = !empty($tag['name'])?$tag['name']:'vo';
$action     = $tag['action'];
$checkbox   = $tag['checkbox'];
if(isset($tag['actionlist'])) {
$actionlist = explode(',',trim($tag['actionlist']));
}
if(substr($tag['show'],0,1)=='$') {
$show   = $this->tpl->get(substr($tag['show'],1));
}else {
$show   = $tag['show'];
}
$show       = explode(',',$show);
$colNum     = count($show);
if(!empty($checkbox))   $colNum++;
if(!empty($action))     $colNum++;
$parseStr	= "<!-- Think 系统列表组件开始 -->\n";
$parseStr  .= '<table id="'.$id.'" class="'.$style.'" cellpadding=0 cellspacing=0 >';
$parseStr  .= '<tr><td colspan="'.$colNum.'" class="topTd" >&nbsp; </td></tr>';
$parseStr  .= '<tr class="row" >';
$fields = array();
foreach($show as $key=>$val) {
$fields[] = explode(':',$val);
}
if(!empty($checkbox) &&'true'==strtolower($checkbox)) {
$parseStr .='<th width="8"><input type="checkbox" id="check" onclick="CheckAll(\''.$id.'\')"></th>';
}
foreach($fields as $field) {
$property = explode('|',$field[0]);
$showname = explode('|',$field[1]);
if(isset($showname[1])) {
$parseStr .= '<th width="'.$showname[1].'">';
}else {
$parseStr .= '<th>';
}
$showname[2] = isset($showname[2])?$showname[2]:$showname[0];
$parseStr .= '<a href="javascript:sortBy(\''.$property[0].'\',\'{$sort}\',\''.MODULE_NAME.'\',\''.ACTION_NAME.'\')" title="'.L('TAG_LANG_ORDER').$showname[2].'{$sortType} ">'.$showname[0].'<eq name="order" value="'.$property[0].'" ><img src="__TMPL__Common/images/{$sortImg}.gif" width="12" height="17" border="0" align="absmiddle"></eq></a></th>';
}
if(!empty($action)) {
$parseStr .= '<th >'.l('TAG_LANG_OPERATE').'</th>';
}
$parseStr .= '</tr>';
$parseStr .= '<volist name="'.$datasource.'" id="'.$name.'" ><tr class="row" >';
if(!empty($checkbox)) {
$parseStr .= '<td>';
$parseStr .= '<if condition="$'.$name.'[level] eq -1"><input type="checkbox" name="key" class="key" value="{$'.$name.'.'.$pk.'}"><else />&nbsp;</if>';
$parseStr .= '</td>';
}
foreach($fields as $field) {
$parseStr   .=  '<td>';
if(!empty($field[2])) {
$href = explode('|',$field[2]);
if(count($href)>1) {
$array = explode('^',$href[1]);
if(count($array)>1) {
foreach ($array as $a){
$temp[] =  '\'{$'.$name.'.'.$a.'|addslashes}\'';
}
$parseStr .= '<a href="javascript:'.$href[0].'('.implode(',',$temp).')">';
}else{
$parseStr .= '<a href="javascript:'.$href[0].'(\'{$'.$name.'.'.$href[1].'|addslashes}\')">';
}
}else {
$parseStr .= '<a href="javascript:'.$field[2].'(\'{$'.$name.'.'.$pk.'|addslashes}\')">';
}
}
if(strpos($field[0],'^')) {
$property = explode('^',$field[0]);
foreach ($property as $p){
$unit = explode('|',$p);
if(count($unit)>1) {
$parseStr .= '{$'.$name.'.'.$unit[0].'|'.$unit[1].'} ';
}else {
$parseStr .= '{$'.$name.'.'.$p.'} ';
}
}
}else{
$property = explode('|',$field[0]);
if(count($property)>1) {
$parseStr .= '{$'.$name.'.'.$property[0].'|'.$property[1].'}';
}else {
$parseStr .= '{$'.$name.'.'.$field[0].'}';
}
}
if(!empty($field[2])) {
$parseStr .= '</a>';
}
$parseStr .= '</td>';
}
if(!empty($action)) {
if(!empty($actionlist[0])) {
$parseStr .= '<td>';
foreach($actionlist as $val) {
if(strpos($val,':')) {
$a = explode(':',$val);
$b = explode('|',$a[1]);
if(count($b)>1) {
$c = explode('|',$a[0]);
if(count($c)>1) {
$parseStr .= '<a href="javascript:'.$c[1].'(\'{$'.$name.'.'.$pk.'}\')"><?php if(0== (is_array($'.$name.')?$'.$name.'["status"]:$'.$name.'->status)){ ?>'.$b[1].'<?php } ?></a><a href="javascript:'.$c[0].'({$'.$name.'.'.$pk.'})"><?php if(1== (is_array($'.$name.')?$'.$name.'["status"]:$'.$name.'->status)){ ?>'.$b[0].'<?php } ?></a>&nbsp;';
}else {
$parseStr .= '<a href="javascript:'.$a[0].'(\'{$'.$name.'.'.$pk.'}\')"><?php if(0== (is_array($'.$name.')?$'.$name.'["status"]:$'.$name.'->status)){ ?>'.$b[1].'<?php } ?><?php if(1== (is_array($'.$name.')?$'.$name.'["status"]:$'.$name.'->status)){ ?>'.$b[0].'<?php } ?></a>&nbsp;';
}
}else {
$parseStr .= '<a href="javascript:'.$a[0].'(\'{$'.$name.'.'.$pk.'}\')">'.$a[1].'</a>&nbsp;';
}
}else{
$array	=	explode('|',$val);
if(count($array)>2) {
$parseStr	.= ' <a href="javascript:'.$array[1].'(\'{$'.$name.'.'.$array[0].'}\')">'.$array[2].'</a>&nbsp;';
}else{
$parseStr .= ' {$'.$name.'.'.$val.'}&nbsp;';
}
}
}
$parseStr .= '</td>';
}
}
$parseStr	.= '</tr></volist><tr><td colspan="'.$colNum.'" class="bottomTd"> &nbsp;</td></tr></table>';
$parseStr	.= "\n<!-- Think 系统列表组件结束 -->\n";
return $parseStr;
}
public function _imgUpload($attr)
{
$tag        = $this->parseXmlAttr($attr,'imgUpload');
$name       = $tag['name'];
$id 		= $tag['id'];
$width      = $tag['width']?$tag['width']:'35';
$height     = $tag['height']?$tag['height']:'35';
$value	    = $tag['value'];
if($value)
{
$img_url = "<if condition=\"".$value." eq ''\">./admin/Tpl/default/Common/images/no_pic.gif<else />{".$value.'}</if>';
$script = "<if condition=\"".$value." neq ''\">onclick='openimg(\"".$id."\")'</if>";
$hide = "<if condition=\"".$value." eq ''\">display:none;<else />display:inline-block;</if>";
}
else
{
$img_url = './admin/Tpl/default/Common/images/no_pic.gif';
$script = '';
$hide = 'display:none;';
}
$parseStr="<div style='width:120px; height:40px; margin-left:10px; display:inline-block;  float:left;' class='none_border'><script type='text/javascript'>var eid = '".$id."';".
'KE.show({'.
'id : eid,'.
"items : ['upload_image'],".
"skinType: 'tinymce',".
'allowFileManager : true,'.
'resizeMode : 0'.
'});'.
'</script>';
if($value)
$parseStr.= "<div style='font-size:0px;'><textarea id='".$id."' name='".$name."' style='width:120px; height:25px;' >{".$value.'}</textarea> </div></div>';
else
$parseStr.= "<div style='font-size:0px;'><textarea id='".$id."' name='".$name."' style='width:120px; height:25px;' ></textarea> </div>";
$parseStr.="<input type='text' id='focus_".$id."' style='font-size:0px; border:0px; padding:0px; margin:0px; line-height:0px; width:0px; height:0px;' /></div>";
$parseStr.= "<img src='".$img_url."' ".$script." style='display:inline-block; float:left; cursor:pointer; margin-left:10px; border:#ccc solid 1px; width:".$width.'px; height:'.$height."px;' id='img_".$id."' />";
$parseStr.= "<img src='".__ROOT__."/admin/Tpl/default/Common/images/del.gif' style='".$hide." margin-left:10px; float:left; border:#ccc solid 1px; width:35px; height:35px; cursor:pointer;' id='img_del_".$id."' onclick='delimg(\"".$id."\")' title='删除' />";
return $parseStr;
}
}
?>